<template>
  <div class="AddOrUpdate_main add_container column_one">
    <div class="main_main">
      <div class="title">审批意见</div>
      <el-input v-model="opinions" type="textarea" maxlength="100" show-word-limit placeholder="输入内容" />
    </div>
    <div class="main_bottom" v-if="isShowExamine">
      <div>
        <el-button type="reject" @click.stop="submit('2')">全部驳回</el-button>
        <el-button @click.stop="submit('1')">全部通过</el-button>
      </div>
    </div>
    <div class="main_bottom" v-else>
      <el-button type="cancel" @click.stop="cancel">取消</el-button>
      <el-button @click.stop="onSubmit">提交</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AddOrUpdate',
  props: {
    layerid: {},
    id: {},
    isShowExamine: {},
    defaultValue: {}
  },
  data() {
    return {
      opinions: ''
    }
  },
  created() {
    if (!this.id) { // 没有id就是新增
    } else { // 有id就是编辑
      this.getInfo()
    }
  },
  methods: {
    cancel() {
      this.$layer.close(this.layerid)// 关闭弹框
    },
    onSubmit() {
      this.$parent.closeDialog(this.opinions)
      this.$layer.close(this.layerid)// 关闭弹框
    },
    submit(status) {
      const opinions = {}
      opinions.opinions = this.opinions
      opinions.status = status
      this.$parent.closeDialog(opinions)
      this.$layer.close(this.layerid)// 关闭弹框
    }
  }
}
</script>

<style lang="less" scoped>
.main_main {
  padding: 20px;
  height: 100%;

  .title {
    color: #303133;
    font-size: 16px;
    margin-bottom: 10px;
  }

  /deep/ .el-textarea__inner {
    height: 100px;
  }
}
</style>
